#include<fuquOS/type.h>

typedef struct {
	u32 base_addr_low;
	u32 base_addr_high;
	u32 length_low;
	u32 length_high;
	u32 type;
} __attribute__((packed)) MemoryDescriptor;

typedef struct {
	u32 base_addr_low;
	u32 base_addr_high;
	u32 length_low;
	u32 length_high;
} __attribute__((packed)) PhysicalMemoryBlock;

typedef struct PhysicalMemoryLink{
	PhysicalMemoryBlock *data;
	struct PhysicalMemoryLink *next;
} PhysicalMemoryLink;

// 空闲内存链表
extern PhysicalMemoryLink *pml;
// 已分配内存链表
extern PhysicalMemoryLink *assigned_pml;

void memory_init(void);
void *kmalloc(u32 size);
void kfree(void *ptr);